package com.example.orderflow.controller.view;

import com.example.orderflow.controller.base.ABaseController;
import com.example.orderflow.entity.vo.ResponseVO;
import com.example.orderflow.exception.BusinessException;
import com.example.orderflow.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName AllOrdersController
 * @Description: 查看全部订单信息
 * @Since JDK 1.8
 * @Create 2024/7/12 16:07
 */

@RestController
public class AllOrdersController extends ABaseController {

    @Autowired
    OrderInfoService orderInfoService;

    /**
     * @create: 2024/7/12 16:07
     * @description: 查看全部订单信息
     * @return List<orderInfo>
     */
    @GetMapping("/AllOrders")
    public ResponseVO allOrders() {
        try {
            return getSuccessResponseVO(orderInfoService.getAllOrders());
        }catch (Exception e){
            throw new BusinessException("系统异常，请联系管理员处理");
        }

    }

}
